﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="newRoom.aspx.cs" Inherits="chatblog.usercate.dialog.newRoom" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src ="~/usercate/dialog/chatEditor.ascx" TagName ="chatEditor" TagPrefix ="cc1" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title> 
    <link href="css/newRoom.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <center>
            <div class ="chatDiv">
                <div class ="chatnavDiv">
                    &nbsp;<span >与。。。交谈中</span>
                </div>
                <div class ="chattoolDiv">
                    <div class ="chattoolnavDiv">
                        <ul>
                            <li><a>工具</a></li>
                        </ul>
                    </div>
                    <div class ="chattoolcontentDiv">
                    </div>
                </div>
                <div class="chatbodyDiv">
                    <table  cellspacing ="0px" cellpadding ="0px"  class ="chatbodyTable" style =" padding-left:5px;">
                        <tr style =" width:100%;">
                            <td colspan="3"  style=" line-height:5px;">&nbsp;</td>
                        </tr>
                        <tr id="chatbodyMiddleTr">
                            <td id ="chatbodyLeftTd" >
                                <div id="chatbodydisplayDiv" class ="chatbodyLeftTddiv" style =" overflow:auto ; border-top:solid 1px #4D95EB; border-left:solid 1px #4D95EB; border-right:solid 1px #4D95EB; text-align:left;">
                                </div>
                                <div id="chatbodyeditorDiv" class ="chatbodyLeftTddiv" style =" border-bottom:solid 1px #4D95EB; border-left:solid 1px #4D95EB; border-right:solid 1px #4D95EB;">
                                    <cc1:chatEditor   runat ="server" />
                                </div>
                                <div id="chatbodysendMsgDiv" class ="chatbodyLeftTddiv" style =" text-align:right; background-color:lightBlue; height:50px;">
                                      <table style=" width:100%">
                                        <tr>
                                            <td >   &nbsp;
                                            </td>  
                                            <td style =" text-align:right;width:209px;">
                                                <input id="closePageButton"  value ="关闭" type="button"  onclick ="closePage();"/>
                                                <input id="sendMessageButton" disabled ="false"   title ="不能发送空字符串或者空格字符串！" type="button"  value="发送" onclick ="sendMessage() ;"   />
                                            </td>
                                            <td style ="width:20px;">
                                                <input id="hotKeysButton" title ="点击修改'发送'按钮的快捷键" type="button" onclick ="return showHotKeySelect(this);"  style ="  width :15px; height :20px; line-height :20px; background-color :lightBlue; background-attachment :scroll  ; background-image :url(../img/hotkey.gif); background-repeat :no-repeat ;"/>
                                                <ul id="sendMsgHotKeyUl" style ="   position:absolute ; display :none; list-style-type:none; font-size:smaller ; background-color:#ECECEC; border:solid 1px Gray; text-align :left ">
                                                    <li style ="background:url(../img/tagleft.gif)  left -25px no-repeat;" onclick ="hotKeyLiSelected(this);" onmouseover ="this.style.background='url(../img/tagleft.gif)  no-repeat';" onmouseout ="this.style.background='url(../img/tagleft.gif)  left -25px no-repeat';">                                                         
                                                        <table >
                                                            <tr>
                                                                <td style =" width :20px">
                                                                    <img  alt="" src ="../img/selectHotKey.ico" />
                                                                </td>
                                                                <td>
                                                                    <span>按 Ctrl+Enter 发送</span>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </li>
                                                    <li style ="background:url(../img/tagleft.gif)  left -25px no-repeat;" onclick ="hotKeyLiSelected(this);" onmouseover ="this.style.background='url(../img/tagleft.gif)  no-repeat';" onmouseout ="this.style.background='url(../img/tagleft.gif)  left -25px no-repeat';">
                                                        <table >
                                                            <tr>
                                                                <td style =" width :20px">
                                                                </td>
                                                                <td>
                                                                    <span>按 Enter 发送</span>
                                                                </td>
                                                            </tr>
                                                        </table>                                                                    
                                                    </li>
                                                </ul>
                                            </td>
                                        </tr>
                                    </table> 
                                                         
                                </div>
                            </td>
                            <td id ="chatbodyMiddleTd">
                                <img alt="" title="点击隐藏" style =" height:30px;width:15px; border:solid 1px #4D95EB" src="../img/right.ico" onclick ="showchatBodyRightTd(this);"/> 
                            </td>
                            <td id ="chatbodyRightTd" >
                                &nbsp;
                            </td>
                        </tr>
                        <tr style =" width:100%; ">
                            <td colspan="3"  style =" line-height:5px;">&nbsp;</td>
                        </tr>
                    </table>
                </div>
            </div>
        </center>    
    </form>
    <script src="js/cookies.js" type="text/javascript"></script>
        <script type="text/javascript" >
            //浏览器类型
            var SysAgent = {};
            var ua = navigator.userAgent.toLowerCase();
            if (window.ActiveXObject)
                SysAgent.ie = ua.match(/msie ([\d.]+)/)[1]
            else if (document.getBoxObjectFor)
                SysAgent.firefox = ua.match(/firefox\/([\d.]+)/)[1]
            else if (window.MessageEvent && !document.getBoxObjectFor)
                SysAgent.chrome = ua.match(/chrome\/([\d.]+)/)[1]
            else if (window.opera)
                SysAgent.opera = ua.match(/opera\/([\d.]+)/)[1]
            else if (window.openDatabase)
                SysAgent.safari = ua.match(/version\/([\d.]+)/)[1];

            var sendMsgHotKey = "";  //或者 Enter  这个属性用来记录当禁用Cookie的时候记录发送消息的快捷键； 每次用的时候最好调用sendMsgHotKey = getSendMsgHotKeyCookie();                                                                
            var sendMsgHotKeyCookieName = "sendMsgHotKey";
            var sendMsgHotKeyCookieDomain = "HotKey";

            //辅助方法，设置发送消息快捷键
            function setHotKey() {
                sendMsgHotKey = getSendMsgHotKeyCookie();
                var hotkeyliList = $("#sendMsgHotKeyUl > li");
                if (sendMsgHotKey == "CtrlEnter") {
                    hotkeyliList[0].getElementsByTagName('td')[0].innerHTML = '<img  alt="" src ="../img/selectHotKey.ico" />';
                    hotkeyliList[1].getElementsByTagName('td')[0].innerHTML = '';
                }
                else if (sendMsgHotKey == "Enter") {
                    hotkeyliList[1].getElementsByTagName('td')[0].innerHTML = '<img  alt="" src ="../img/selectHotKey.ico" />';
                    hotkeyliList[0].getElementsByTagName('td')[0].innerHTML = '';
                }
            }
            //选择发送消息快捷键(li)的点击事件方法
            function hotKeyLiSelected(thisObj) {
                try {
                    thisObj = thisObj || window.event;
                    clearEventBubble(thisObj);
                    var hotkeyliList = $("#sendMsgHotKeyUl > li");
                    sendMsgHotKey = (hotkeyliList[0] == thisObj) ? "CtrlEnter" : "Enter";
                    setSendMsgHotKeyCookie(sendMsgHotKey);
                    setHotKey();
                    $('#sendMsgHotKeyUl')[0].style.display = "none";
                }
                catch (e) {
                }
                finally {
                    clearEventBubble(thisObj);
                    return false;
                }

                //document .cookie
            }
            //显示 选择快捷键的 div
            function showHotKeySelect(thisObj) {
                try {
                    //thisObj = thisObj || window.event; //alert(window.event.x + " " + window.event.clientX + " " + window.event.pageX);  //alert(getX(thisObj) + " " + getY(thisObj ));
                    //clearEventBubble(thisObj);
                    //alert($('#sendMsgHotKeyUl'));
                    var sendmsgHotKeyUl = $('#sendMsgHotKeyUl')[0];
                    sendmsgHotKeyUl.style.display = 'block';
                    sendmsgHotKeyUl.style.left = getLeft(thisObj)+20+"px";
                    sendmsgHotKeyUl.style.top = getTop(thisObj);
                } catch (e)
            { }
                finally {
                    //clearEventBubble(thisObj);
                    return false;
                }
            }
            //隐藏 选择快捷键的 div
            function hideHotKeySelect() {
                $('#sendMsgHotKeyUl')[0].style.display = 'none';
            }
            //设置 发送按钮快捷键 的cookie
            function setSendMsgHotKeyCookie(hotKeyMode) {        //"CtrlEnter" 或者 "Enter"
                //if (isEnableCookie()) 
                {
                    setCookie(sendMsgHotKeyCookieName, hotKeyMode, sendMsgHotKeyCookieDomain);
                }
                sendMsgHotKey = hotKeyMode;
            }
            //获取 发送按钮快捷键 的cookie
            function getSendMsgHotKeyCookie() {
                //if (isEnableCookie()) 
                {
                    sendMsgHotKey = getcookie(sendMsgHotKeyCookieName);
                    if (sendMsgHotKey == "")
                        sendMsgHotKey = "CtrlEnter";
                }
                return sendMsgHotKey;
            }
            sendMsgHotKey = getSendMsgHotKeyCookie();
            setHotKey();
            if (SysAgent.firefox) {
                $('#sendMessageButton')[0].disabled = false;
                $('#hotKeysButton')[0].disabled = true;
                $('#hotKeysButton')[0].style.display = "none";
            }


            function getQueryString(queryName) {
                var queryValue = "";
                var queryFound = false;
                if (window.location.search != "") {
                    var search = window.location.search;
                    var i = 0;
                    while (i <= search.length) {
                        start = i;
                        end = start + queryName.length;
                        if (search.substring(start, end) == queryName) {
                            queryFound = true;
                            break;
                        }
                        i++;
                    }
                    if (queryFound) {
                        start = end + 1;
                        end = search.indexOf("&", start);
                        if (end < start)
                            end = search.length;
                        var getvalue = search.substring(start, end);
                        return unescape(getvalue);
                    }
                }
                return queryValue;
            }
      </script>  
    <script src="js/newRoom.js" type="text/javascript"></script> 
</body>
</html>
